/*
explode();
explode(n,sep,str) for GML by HelpTheWretched
modified so it doesn't use variable_local_array_set
*/
var seps, substr, str;
seps = string_count(argument1,argument2);
if (argument0 > seps)
{
    return "-1";
}
else
{
    for (i=0; i<seps+1; i+=1)
    {
        if (i < seps)
        {
            substr[i] = string_copy(argument2,1,string_pos(argument1,argument2)-1);
        }
        else
        {
            substr[i] = argument2;
        }
        argument2 = string_delete(argument2,1,string_length(string(substr[i])+string(argument1)));
    }
    return (substr[argument0]);
}

